-
Couldn't load subscription status.
- Fork 1.2k
Declare field 'tv_nsec' of structure 'timespec' as 'i32' for AIX #4750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@rustbot label +stable-nominated |
c1d80a2 to
ffaf067
Compare
src/unix/mod.rs
Outdated
| // On AIX, <stat.h> declares 'tv_nsec' as 'long', but the underlying | ||
| // system calls return a 4-byte value in both 32-bit and 64-bit modes. | ||
| // It is declared as 'i32' to avoid using the other undefined 4 bytes | ||
| // in the 64-bit mode. | ||
| #[cfg(not(target_env = "gnu"))] | ||
| pub struct timespec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make things a bit cleaner, maybe exclude target_os = "aix" here? Then put the struct in src/unix/aix/mod.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as suggested, thanks!
I think this is reasonable to change on our side, but isn't it a problem for C users as well if the header doesn't match the syscalls? Technically posix specifies |
The problem can be reproduced with a C test case as well. AIX should have mapped Exposing |
…it and 64-bit modes for AIX.
ffaf067 to
8c448c4
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks!
On AIX, <sys/stat.h> declares field
tv_nsecofstruct timespecaslong, but the underlying system calls return a 4-byte value in both 32-bit and 64-bit modes. This PR changes to declaretv_nsecasi32in thelibccrate to avoid including the other undefined 4 bytes in the 64-bit mode.Description
Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI